package com.incar.chuxing.utils;

import com.incar.chuxing.bean.MapParksAndCarsBean;
import com.incar.chuxing.bean.NearParkOrCarBean;
import com.incar.chuxing.bean.ParkDetailBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Michael on 11/8.
 */

public class DataBeanConvert {
    //点击地图的车辆图标，获得的实体类数据转成网点实体类的数据类型
    public static List<ParkDetailBean.AttachmentBean.CarsBean> carToPark(MapParksAndCarsBean.AttachmentBean.CarModelsBean onCar) {

        List<ParkDetailBean.AttachmentBean.CarsBean> list = new ArrayList<>();
        ParkDetailBean.AttachmentBean.CarsBean carsBean = new ParkDetailBean.AttachmentBean.CarsBean();
        carsBean.setBrand(onCar.getBrand());
        carsBean.setModel(onCar.getModel());
        carsBean.setLicenseTag(onCar.getLicenseTag());
        carsBean.setMileage(onCar.getMileage());
        carsBean.setId(onCar.getId());
        carsBean.setParkId(onCar.getParkId());
        carsBean.setSeat(onCar.getSeat());
        carsBean.setPicture(onCar.getPicture());
        carsBean.setAbatement(onCar.getAbatement());
        carsBean.setCompanyByRisk(onCar.getCompanyByRisk());
        carsBean.setParkName("");
        carsBean.setLatitude(onCar.getLatitude());
        carsBean.setLongitude(onCar.getLongitude());
        carsBean.setTimeStr(onCar.getTimeStr());
        carsBean.setUserRemark(onCar.getUserRemark());
        ParkDetailBean.AttachmentBean.CarsBean.ValuationRuleModelBean vrBean = new ParkDetailBean.AttachmentBean.CarsBean.ValuationRuleModelBean();
        vrBean.setWeekDayPrice(onCar.getValuationRuleModel().getWeekDayPrice());
        vrBean.setMileagePrice(onCar.getValuationRuleModel().getMileagePrice());
        vrBean.setStartingPrice(onCar.getValuationRuleModel().getStartingPrice());
        carsBean.setValuationRuleModel(vrBean);
        list.add(carsBean);
        return list;


    }

    //点击立即用车，返回的是最近的一个车，获得的实体类数据转成网点实体类的数据类型
    public static List<ParkDetailBean.AttachmentBean.CarsBean> nearCarToPark(NearParkOrCarBean.AttachmentBean.CarBean nearOneCar) {
        List<ParkDetailBean.AttachmentBean.CarsBean> list = new ArrayList<>();
        ParkDetailBean.AttachmentBean.CarsBean carsBean = new ParkDetailBean.AttachmentBean.CarsBean();
        carsBean.setBrand(nearOneCar.getBrand());
        carsBean.setModel(nearOneCar.getModel());
        carsBean.setLicenseTag(nearOneCar.getLicenseTag());
        carsBean.setMileage(nearOneCar.getMileage());
        carsBean.setId(nearOneCar.getId());
        carsBean.setParkId(nearOneCar.getParkId());
        carsBean.setSeat(nearOneCar.getSeat());
        carsBean.setPicture(nearOneCar.getPicture());
        carsBean.setAbatement(nearOneCar.getAbatement());
        carsBean.setCompanyByRisk(nearOneCar.getCompanyByRisk());
        carsBean.setParkName("");
        carsBean.setLatitude(nearOneCar.getLatitude());
        carsBean.setLongitude(nearOneCar.getLongitude());
        carsBean.setTimeStr(nearOneCar.getTimeStr());
        carsBean.setUserRemark(nearOneCar.getUserRemark());
        ParkDetailBean.AttachmentBean.CarsBean.ValuationRuleModelBean vrBean = new ParkDetailBean.AttachmentBean.CarsBean.ValuationRuleModelBean();
        vrBean.setWeekDayPrice(nearOneCar.getValuationRuleModel().getWeekDayPrice());
        vrBean.setMileagePrice(nearOneCar.getValuationRuleModel().getMileagePrice());
        vrBean.setStartingPrice(nearOneCar.getValuationRuleModel().getStartingPrice());
        carsBean.setValuationRuleModel(vrBean);
        list.add(carsBean);
        return list;
    }

    //点击立即用车，返回的是最近的一个网点，获得的实体类数据转成网点实体类的数据类型
    public static List<ParkDetailBean.AttachmentBean.CarsBean> nearParkToPark(List<NearParkOrCarBean.AttachmentBean.ParksBean.CarModelListBean> result) {
        List<ParkDetailBean.AttachmentBean.CarsBean> list = new ArrayList<>();
        for (int i = 0; i < result.size(); i++) {
            ParkDetailBean.AttachmentBean.CarsBean carsBean = new ParkDetailBean.AttachmentBean.CarsBean();
            NearParkOrCarBean.AttachmentBean.ParksBean.CarModelListBean nearOneCar = result.get(i);
            carsBean.setBrand(nearOneCar.getBrand());
            carsBean.setModel(nearOneCar.getModel());
            carsBean.setLicenseTag(nearOneCar.getLicenseTag());
            carsBean.setMileage(nearOneCar.getMileage());
            carsBean.setId(nearOneCar.getId());
            carsBean.setParkId(nearOneCar.getParkId());
            carsBean.setSeat(nearOneCar.getSeat());
            carsBean.setPicture(nearOneCar.getPicture());
            carsBean.setAbatement(nearOneCar.getAbatement());
            carsBean.setCompanyByRisk(nearOneCar.getCompanyByRisk());
            carsBean.setParkName(nearOneCar.getParkName());
            carsBean.setLatitude(nearOneCar.getLatitude());
            carsBean.setLongitude(nearOneCar.getLongitude());
            carsBean.setTimeStr(nearOneCar.getTimeStr());
            ParkDetailBean.AttachmentBean.CarsBean.ValuationRuleModelBean vrBean = new ParkDetailBean.AttachmentBean.CarsBean.ValuationRuleModelBean();
            vrBean.setWeekDayPrice(nearOneCar.getValuationRuleModel().getWeekDayPrice());
            vrBean.setMileagePrice(nearOneCar.getValuationRuleModel().getMileagePrice());
            vrBean.setStartingPrice(nearOneCar.getValuationRuleModel().getStartingPrice());
            carsBean.setValuationRuleModel(vrBean);
            list.add(carsBean);
        }
        return list;
    }
}